<template>
  <li class="dropdown user user-menu" :class="{open:$store.state.NavBar.dropDownMenu==='user'}">
    <a class="dropdown-toggle" @click.stop.prevent="clickUser">
      <img src="../../assets/img/avatar.png" class="user-image">
      <span class="hidden-xs">{{this.$store.state.User.currentUser.name}}</span>
    </a>
    <ul class="dropdown-menu">
      <li class="user-header">
        <img src="../../assets/img/avatar.png" class="img-circle">
        <p>
          {{this.$store.state.User.currentUser.name}} - {{this.$store.state.User.currentUser.roleName}}
          <small>{{this.$store.state.User.currentUser.unitsName}}</small>
        </p>
      </li>
      <li class="user-footer">
        <div class="pull-left">
          <a @click.prevent="changePassword" class="btn btn-default btn-flat">修改密码</a>
        </div>
        <div class="pull-right">
          <a @click.prevent="logout" class="btn btn-default btn-flat">退出登录</a>
        </div>
      </li>
    </ul>
  </li>
</template>

<script>
  import {SET_NAV_DROP_DOWN} from "../../store/mutationTypes"

  export default {
    name: "UserMenu",
    data() {
      return {
        isPasswordChange:false
      }
    },
    methods: {
      clickUser() {
        this.$store.commit(SET_NAV_DROP_DOWN, this.$store.state.NavBar.dropDownMenu === "user"?"":"user")
      },
      changePassword() {
        this.$emit("changePassword")
      },
      logout() {
        this.$emit("logout");
      }
    }
  }
</script>



// WEBPACK FOOTER //
// UserMenu.vue?2108b922
